<style lang="less">
    @import "./favorite.less";
</style>
<template>
    <div class="index">

		    <div  class="volunteer-1" align="left" style="margin-top:30px"> 
		        <template>
		    		<Icon type="plus-circled" style="color: #ee9900;font-size: 18px;">
           			</Icon>
           			<span style="font-size:17px">第一批次
          			</span>
				</template> 
		    </div>
		     <hr style='margin-top:10px'>
		    <div class="operation-1" style='margin-top:30px'>
		    	<template>
				     <Table border :columns="columns7" :data="data6"></Table>
				</template>
		    </div>
		    
		     <div class="volunteer-2" align="left" style="margin-top:30px">
		        <template>
		    		<Icon type="plus-circled" style="color: #ee9900;font-size: 18px;">
           			</Icon>
           			<span style="font-size:17px">第二批次
          			</span>
				</template> 
		    </div>
		     <hr style='margin-top:10px'>
		    <div class="operation-2" style='margin-top:30px'>
		    	<template>
				     <Table border :columns="columns8" :data="data8"></Table>
				</template>
		    </div>
		    
		     <div class="volunteer-3" align="left" style="margin-top:30px">
		        <template>
		    		<Icon type="plus-circled" style="color: #ee9900;font-size: 18px;">
           			</Icon>
           			<span style="font-size:17px">第三批次
          			</span>
				</template> 
		    </div>
		     <hr style='margin-top:10px'>
		    <div class="operation-3" style='margin-top:30px'>
		    	<template>
				     <Table border :columns="columns3" :data="data3"></Table>
				</template>
		    </div>
		    
		     <div class="volunteer-4" align="left" style="margin-top:30px;">
		        <template>
		    		<Icon type="plus-circled" style="color: #ee9900;font-size: 18px;">
           			</Icon>
           			<span style="font-size:17px">专科/高职
          			</span>
				</template> 
		    </div>
		     <hr style='margin-top:10px'>
		    <div class="operation-4" style='margin-top:30px;margin-bottom: 145px;'>
		    	<template>
				     <Table border :columns="columns4" :data="data4"></Table>
				</template>
		    </div>
		   <div  class="bottom" style = "display:block;" >
		   <div class="footer-content">
            <Card  v-show="isShow" style = "width :1279px;height:136px">
                <p slot="title">学校pk</p>
                
                <li class = "pk" v-for="tab in tabs"><span>{{tab}}</span></li>
                <Button type="primary" style="margin-left:20px" v-on:click="comparison()">对比</Button>
                <Button type="primary" style="margin-left:20px" v-on:click="close()">关闭</Button>
            </Card>
           </div>
           </div>
    </div>

</template>

<script>
    /* eslint-disable space-before-function-paren */
    
        import {exam} from '../../../../api/index.js';

        export default {
            data () {
                return {
                    batch1: '01',
                    batch2: '02',
                    batch3: '03',
                    batch4: '04',
                    isShow: false,
                    tabs: [],
                    share: true,
                    collegeid: [],
                    columns7: [
                       // {
                       //     type: 'selection',
                      //      width: 60,
                       //     align: 'center'
                      //  },
                        {
                            title: '院校名称',
                            key: 'martich_school_name',
                            width: 145
                        },
                        {
                            title: '专业名称',
                            key: 'view_zy_name',
                            width: 130
                        },
                        {
                            title: '2017计划',
                            key: 'zssl_one'
                        },
                        {
                            title: '2016计划',
                            key: 'zssl_two'
                        },
                        {
                            title: '2015计划',
                            key: 'zssl_three'
                        },
                        {
                            title: '平均录取系数',
                            key: 'avg_diff'
                        },
                        {
                            title: '平均线差值',
                            key: 'avg_xc'
                        },
                        {
                            title: '平均位次',
                            key: 'avg_pm'
                        },
                        {
                            title: '操作',
                            key: 'action',
                            width: 300,
                            align: 'center',
                            render: (h, params) => {
                                return h('div', [
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.pk1(params.index);
                                            }
                                        }
                                    }, '加入pk'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.introductionfirst(params.index);
                                            }
                                        }
                                    }, '简介'),
                                    // h('Button', {
                                    //     props: {
                                    //         type: 'warning',
                                    //         size: 'small'
                                    //     },
                                    //     style: {
                                    //         marginRight: '5px'
                                    //     },
                                    //     on: {
                                    //         click: () => {
                                    //             this.job1(params.index);
                                    //         }
                                    //     }
                                    // }, '就业'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.historyfirst(params.index);
                                            }
                                        }
                                    }, '历史录取'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.qxfirst(params.index);
                                            }
                                        }
                                    }, '取消收藏')
                                ]);
                            }
                        }
                    ],
                    data6: [],
                    columns8: [

                        {
                            title: '院校名称',
                            key: 'martich_school_name',
                            width: 145
                        },
                        {
                            title: '专业名称',
                            key: 'view_zy_name',
                            width: 130
                        },
                        {
                            title: '2017计划',
                            key: 'zssl_one'
                        },
                        {
                            title: '2016计划',
                            key: 'zssl_two'
                        },
                        {
                            title: '2015计划',
                            key: 'zssl_three'
                        },
                        {
                            title: '平均录取系数',
                            key: 'avg_diff'
                        },
                        {
                            title: '平均线差值',
                            key: 'avg_xc'
                        },
                        {
                            title: '平均位次',
                            key: 'avg_pm'
                        },
                        {
                            title: '操作',
                            key: 'action',
                            width: 260,
                            align: 'center',
                            render: (h, params) => {
                                return h('div', [
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.pk2(params.index);
                                            }
                                        }
                                    }, '加入pk'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.introductionsecond(params.index);
                                            }
                                        }
                                    }, '简介'),
                                    // h('Button', {
                                    //     props: {
                                    //         type: 'warning',
                                    //         size: 'small'
                                    //     },
                                    //     style: {
                                    //         marginRight: '5px'
                                    //     },
                                    //     on: {
                                    //         click: () => {
                                    //             this.job2(params.index);
                                    //         }
                                    //     }
                                    // }, '就业'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.historysecond(params.index);
                                            }
                                        }
                                    }, '历史录取'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.qxfirst(params.index);
                                            }
                                        }
                                    }, '取消收藏')
                                ]);
                            }
                        }
                    ],
                    data8: [],
                    columns3: [

                        {
                            title: '院校名称',
                            key: 'martich_school_name',
                            width: 145
                        },
                        {
                            title: '专业名称',
                            key: 'view_zy_name',
                            width: 130
                        },
                        {
                            title: '2017计划',
                            key: 'zssl_one'
                        },
                        {
                            title: '2016计划',
                            key: 'zssl_two'
                        },
                        {
                            title: '2015计划',
                            key: 'zssl_three'
                        },
                        {
                            title: '平均录取系数',
                            key: 'avg_diff'
                        },
                        {
                            title: '平均线差值',
                            key: 'avg_xc'
                        },
                        {
                            title: '平均位次',
                            key: 'avg_pm'
                        },
                        {
                            title: '操作',
                            key: 'action',
                            width: 260,
                            align: 'center',
                            render: (h, params) => {
                                return h('div', [
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.pk3(params.index);
                                            }
                                        }
                                    }, '加入pk'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.introductionthird(params.index);
                                            }
                                        }
                                    }, '简介'),
                                    // h('Button', {
                                    //     props: {
                                    //         type: 'warning',
                                    //         size: 'small'
                                    //     },
                                    //     style: {
                                    //         marginRight: '5px'
                                    //     },
                                    //     on: {
                                    //         click: () => {
                                    //             this.job3(params.index);
                                    //         }
                                    //     }
                                    // }, '就业'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.historythird(params.index);
                                            }
                                        }
                                    }, '历史录取'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.qxfirst(params.index);
                                            }
                                        }
                                    }, '取消收藏')
                                ]);
                            }
                        }
                    ],
                    data3: [],
                    columns4: [

                        {
                            title: '院校名称',
                            key: 'martich_school_name',
                            width: 145
                        },
                        {
                            title: '专业名称',
                            key: 'view_zy_name',
                            width: 130
                        },
                        {
                            title: '2017计划',
                            key: 'zssl_one'
                        },
                        {
                            title: '2016计划',
                            key: 'zssl_two'
                        },
                        {
                            title: '2015计划',
                            key: 'zssl_three'
                        },
                        {
                            title: '平均录取系数',
                            key: 'avg_diff'
                        },
                        {
                            title: '平均线差值',
                            key: 'avg_xc'
                        },
                        {
                            title: '平均位次',
                            key: 'avg_pm'
                        },
                        {
                            title: '操作',
                            key: 'action',
                            width: 260,
                            align: 'center',
                            render: (h, params) => {
                                return h('div', [
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.pk4(params.index);
                                            }
                                        }
                                    }, '加入pk'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.introductionfouth(params.index);
                                            }
                                        }
                                    }, '简介'),
                                    // h('Button', {
                                    //     props: {
                                    //         type: 'warning',
                                    //         size: 'small'
                                    //     },
                                    //     style: {
                                    //         marginRight: '5px'
                                    //     },
                                    //     on: {
                                    //         click: () => {
                                    //             this.job4(params.index);
                                    //         }
                                    //     }
                                    // }, '就业'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.historyfouth(params.index);
                                            }
                                        }
                                    }, '历史录取'),
                                    h('Button', {
                                        props: {
                                            type: 'warning',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.qxfirst(params.index);
                                            }
                                        }
                                    }, '取消收藏')
                                ]);
                            }
                        }
                    ],
                    data4: []
                };
            },
            methods: {
                createVolunteer() {
                    this.share = false;
                },
                historyfirst (index) {
                    this.$router.push({
                        name: 'volunteer_favorite_history',
                        params: {
                            id: this.data6[index].id
                        }
                    });
                },
                historysecond (index) {
                    this.$router.push({
                        name: 'volunteer_favorite_history',
                        params: {
                            id: this.data8[index].id
                        }
                    });
                },
                historythird (index) {
                    this.$router.push({
                        name: 'volunteer_favorite_history',
                        params: {
                            id: this.data3[index].id
                        }
                    });
                },
                historyfouth (index) {
                    this.$router.push({
                        name: 'volunteer_favorite_history',
                        params: {
                            id: this.data4[index].id
                        }
                    });
                },
                qxfirst (index) {
                    exam.addCollection_post({"data": {"mntbId":this.data6[index].id}}).then((res) => {
                        if(res.data.resCode==0){
                             var msg = "<h2>取消收藏</h2>"+this.data6[index].martich_school_name + " 的 " + this.data6[index].view_zy_name ;
                            this.$Message.success(msg);
                            this.firstLoad();
                        }
                    }, function (error) {
                        alert("系统异常，请先联系管理员");
                    });
                },
                pk1 (index) {
                    this.isShow = true;
                    var _this = this;
                    if (this.tabs.includes(this.data6[index].martich_school_name) === true) {
                        alert('学校已加入对比,请不要重复添加');
                    } else {
                        _this.tabs.push(this.data6[index].martich_school_name);
                        _this.collegeid.push(this.data6[index].martich_school_id);
                    }
                },
                pk2 (index) {
                    this.isShow = true;
                    var _this = this;
                    if (this.tabs.includes(this.data8[index].martich_school_name) === true) {
                        alert('学校已加入对比,请不要重复添加');
                    } else {
                        _this.tabs.push(this.data8[index].martich_school_name);
                        _this.collegeid.push(this.data8[index].martich_school_id);
                    }
                },
                pk3 (index) {
                    this.isShow = true;
                    var _this = this;
                    if (this.tabs.includes(this.data3[index].martich_school_name) === true) {
                        alert('学校已加入对比,请不要重复添加');
                    } else {
                        _this.tabs.push(this.data3[index].martich_school_name);
                        _this.collegeid.push(this.data3[index].martich_school_id);
                    }
                },
                pk4 (index) {
                    this.isShow = true;
                    var _this = this;
                    if (this.tabs.includes(this.data4[index].martich_school_name) === true) {
                        alert('学校已加入对比,请不要重复添加');
                    } else {
                        _this.tabs.push(this.data4[index].martich_school_name);
                        _this.collegeid.push(this.data4[index].martich_school_id);
                    }
                },
                job1 (index) {
                    this.$router.push({
                        name: 'volunteer_favorite_job',
                        params: {
                            id: this.data6[index].schoolId
                        }
                    });
                },
                job2 (index) {
                    this.$router.push({
                        name: 'volunteer_favorite_job',
                        params: {
                            id: this.data8[index].schoolId
                        }
                    });
                },
                job3 (index) {
                    this.$router.push({
                        name: 'volunteer_favorite_job',
                        params: {
                            id: this.data3[index].schoolId
                        }
                    });
                },
                job4 (index) {
                    this.$router.push({
                        name: 'volunteer_favorite_job',
                        params: {
                            id: this.data4[index].schoolId
                        }
                    });
                },
                introductionfirst (index) {
                     //跳转之前执行收藏+1
                    //   exam.addBrowseNumByid_post({data: {professionId: this.data6[index].professionId,schoolId:this.data6[index].schoolId}}).then((res) => {
                    // }, function (error) {
                    // });
                    this.$router.push({
                        name: 'volunteer_favorite_introduction',
                        params: {
                            id: this.data6[index].martich_school_id
                        }
                    });
                },
                introductionsecond(index) {
                    //  //跳转之前执行收藏+1
                    //   exam.addBrowseNumByid_post({data: {professionId: this.data8[index].professionId,schoolId:this.data8[index].schoolId}}).then((res) => {
                    // }, function (error) {
                    // });
                   
                    this.$router.push({
                        name: 'volunteer_favorite_introduction',
                        params: {
                            id: this.data8[index].martich_school_id
                        }
                    });
                },
                introductionthird (index) {
                    
                    // //跳转之前执行收藏+1
                    //   exam.addBrowseNumByid_post({data: {professionId: this.data3[index].professionId,schoolId:this.data3[index].schoolId}}).then((res) => {
                    // }, function (error) {
                    // });
                    //
                    this.$router.push({
                        name: 'volunteer_favorite_introduction',
                        params: {
                            id: this.data3[index].martich_school_id
                        }
                    });
                },
                introductionfouth (index) {
                  // //跳转之前执行收藏+1
                  //     exam.addBrowseNumByid_post({data: {professionId: this.data4[index].professionId,schoolId:this.data4[index].schoolId}}).then((res) => {
                  //   }, function (error) {
                  //   });
                   
                    this.$router.push({
                        name: 'volunteer_favorite_introduction',
                        params: {
                            id: this.data4[index].martich_school_id
                        }
                    });
                },
                firstLoad() {
                    var _this = this;
                    // 查询第一志愿信息
                    exam.collectFindAll_post({data: {"batchId": this.batch1}}).then((res) => {
                        _this.data6=[];
                        for (var i in res.data.data.collectinfo) {
                            _this.data6.push(res.data.data.collectinfo[i]);
                        }
                        if (res.data.resCode === '0') {
                            this.secondLoad();
                        }
                    }, function (error) {
                        console.log(error);
                    });
                },
                secondLoad() {
                    var _this = this;
                    // 查询第二志愿信息
                    exam.collectFindAll_post({data: {"batchId": this.batch2}}).then((res) => {
                        _this.data8=[];
                    // {{batch}}
                        for (var i in res.data.data.collectinfo) {
                            _this.data8.push(res.data.data.collectinfo[i]);
                        }
                        if (res.data.resCode === '0') {
                            this.thirdLoad();
                        }
                    }, function (error) {
                        console.log(error);
                    });
                },
                thirdLoad() {
                    var _this = this;
                    exam.collectFindAll_post({data: {"batchId": this.batch3}}).then((res) => {
                        _this.data3=[];
                        for (var i in res.data.data.collectinfo) {
                            _this.data3.push(res.data.data.collectinfo[i]);
                        }
                        if (res.data.resCode === '0') {
                            this.fouthLoad();
                        }
                    }, function (error) {
                        console.log(error);
                    });
                },
                fouthLoad() {
                    var _this = this;
                    // 查询第专科信息
                    exam.collectFindAll_post({data: {"batchId":this.batch4 }}).then((res) => {
                        _this.data4=[];
                        for (var i in res.data.data.collectinfo) {
                            _this.data4.push(res.data.data.collectinfo[i]);
                        }
                    }, function (error) {
                        console.log(error);
                    });
                },close(){
                	this.isShow = false;
                	this.tabs=[];
                	this.collegeid = [];
                },
                comparison() {
                    this.$router.push({
                        name: 'volunteer_favorite_pk',
                        params: {
                            ids: this.collegeid,
                        }
                    });
                }
            },
            mounted() {
                this.firstLoad();
                
            }
        };
</script>

